﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Private.Master" Inherits="System.Web.Mvc.ViewPage" %>

<%@ Import Namespace="WebHoiChoMuaBan.Controllers.Helpers" %>
<%@ Import Namespace="WebHoiChoMuaBan.Models" %>
<%@ Import Namespace="WebHoiChoMuaBan.Controllers.Utility" %>
<asp:Content ID="Content2" ContentPlaceHolderID="TitleHolder" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadHolder" runat="server">
    <script src="http://cdn.jquerytools.org/1.2.7/full/jquery.tools.min.js"></script>
    <style>
        .modal
        {
            background-color: #fff;
            display: none;
            width: 350px;
            padding: 15px;
            text-align: left;
            border: 2px solid #333;
            opacity: 0.8;
            -moz-border-radius: 6px;
            -webkit-border-radius: 6px;
            -moz-box-shadow: 0 0 50px #ccc;
            -webkit-box-shadow: 0 0 50px #ccc;
        }
        
        .modal h2
        {
            background: url(/media/img/global/info.png) 0 50% no-repeat;
            margin: 0px;
            padding: 10px 0 10px 45px;
            border-bottom: 1px solid #333;
            font-size: 20px;
        }
    </style>
    <script>
        $(document).ready(function () {

            var triggers = $(".modalInput").overlay({

                // some mask tweaks suitable for modal dialogs
                mask: {
                    color: '#ebecff',
                    loadSpeed: 200,
                    opacity: 0.9
                },

                closeOnClick: false
            });

            var buttons = $("#yesno button").click(function (e) {

                // get user input
                var yes = buttons.index(this) === 0;

                // do something with the answer
                triggers.eq(0).html("You clicked " + (yes ? "yes" : "no"));
            });

            $("#prompt form").submit(function (e) {

                // close the overlay
                triggers.eq(1).overlay().close();

                // get user input
                var input = $("input", this).val();

                // do something with the answer
                triggers.eq(1).html(input);

                // do not submit the form
                return e.preventDefault();
            });


            var triggers = $(".modalInput1").overlay({

                // some mask tweaks suitable for modal dialogs
                mask: {
                    color: '#ebecff',
                    loadSpeed: 200,
                    opacity: 0.9
                },

                closeOnClick: false
            });

            var buttons = $("#yesno button").click(function (e) {

                // get user input
                var yes = buttons.index(this) === 0;

                // do something with the answer
                triggers.eq(0).html("You clicked " + (yes ? "yes" : "no"));
            });

            $("#prompt1 form").submit(function (e) {

                // close the overlay
                triggers.eq(1).overlay().close();

                // get user input
                var input = $("input", this).val();

                // do something with the answer
                triggers.eq(1).html(input);

                // do not submit the form
                //  return e.preventDefault();
            });


            $("#EmailButton").click(function () {
                var emailfrom = $("#txtUserEmail").val();
                var name = $("#txtUserName").val();
                var content = $("#txtUserNoiDung").val();
                var userid = $("#txtUserId").val();
                var userto = $("#friendEmailTo").val();
                if (userid == "")
                    userid = "0";
                var dataString = "mailfrom=" + emailfrom + "&name=" + name + "&content=" + content + "&memid=" + userto;
                $.ajax({
                    type: "POST",
                    url: "/Friend/SendEmail",
                    data: dataString,
                    beforeSend: function (xhm) {
                        var ff = document.getElementById("emailLoader");
                        emailLoader.innerHTML = "<img src='/../Content/Images/fb_loader.gif'/>";
                    },
                    success: function (result) {
                        alert("Thông tin được gởi thành công");
                        emailLoader.innerHTML = "";
                    },
                    error: function (req, status, error) {
                        alert("Sorry! We could not receive your feedback at this time.");
                    }
                });

            });

        });
    </script>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContentHolder" runat="server">
    <%
        var hMem = (MemberHelper)ViewData["hMem"];
    %>
    <div class="private_share_post_top">
        <div class="private_sharepost_menu">
            <ul>
                <li><a href="canhan_banbe_private.html" class="menu_select">Bạn bè</a></li>
                <%if (Session["MemId"] != null && hMem.Member.MemId == int.Parse(Session["MemId"] + ""))
                  {%>
                <li>
                    <%= Html.ActionLink("Khách mời kết bạn", "MakeFriendService", "Friend", new { uid = hMem.Member.MemId }, new { @id = "private_menu_friend" })%>
                </li>
                <%} %>
            </ul>
        </div>
        <div class="private_write_right">
            <div class="private_bt_newspost">
                <a href="vietbai_private.html">
                    <img src="/../Content/Images/icon_newpost.gif">
                    Viết bài mới... </a>
            </div>
        </div>
    </div>
    <div class="private_comment_top">
        <table width="100%" border="0">
            <tr>
                <td colspan="3" align="left" valign="middle">
                    <p class="private_font_bold">
                        Tìm Bạn Bè Cho Dù Họ Ở Bất Cứ Nơi Đâu</p>
                    <p>
                        Bạn liên lạc với bạn bè bằng cách nào? Hãy chọn 1 dịch vụ:</p>
                </td>
            </tr>
            <tr>
                <td width="10%" align="right" valign="middle">
                    <img src="/../Content/Images/icon_friend_yahoo.gif" alt="" />
                </td>
                <td width="37%">
                    <span class="private_font_bold">Yahoo!</span>
                </td>
                <td width="53%" align="right" valign="middle">
                    <a href="#">Tìm kiếm bạn bè</a>
                </td>
            </tr>
            <tr>
                <td colspan="3" bgcolor="#eeeff4" style="padding: 0">
                    <div class="private_box_gmail">
                        <table width="100%" border="0">
                            <tr>
                                <td colspan="2" valign="middle">
                                    <img src="/../Content/Images/icon_friend_gmail.gif" alt="" />
                                    <span class="private_font_bold">Gmail</span>
                                </td>
                            </tr>
                            <tr>
                                <td width="21%" align="right">
                                    <span class="private_font_bold">Email:</span>
                                </td>
                                <td width="79%">
                                    <input type="text" name="textfield3" id="textfield3" class="input_full" />
                                </td>
                            </tr>
                            <tr>
                                <td align="right">
                                    <span class="private_font_bold">Mật khẩu email:</span>
                                </td>
                                <td>
                                    <input type="text" name="textfield" id="textfield" class="input_full" />
                                </td>
                            </tr>
                            <tr>
                                <td align="right">
                                    &nbsp;
                                </td>
                                <td>
                                    <a href="#">
                                        <img src="/../Content/Images/search_friend.gif" alt="" /></a>
                                </td>
                            </tr>
                            <tr>
                                <td align="right">
                                    &nbsp;
                                </td>
                                <td>
                                    <img src="/../Content/Images/icon_lock.gif" alt="" />&nbsp;Facebook sẽ không lưu
                                    trữ mật khẩu của bạn. <a href="#">Tìm hiểu thêm.</a>
                                </td>
                            </tr>
                        </table>
                    </div>
                </td>
            </tr>
            <tr>
                <td align="right">
                    <img src="/../Content/Images/icon_windowlive.gif" alt="" />
                </td>
                <td>
                    <span class="private_font_bold">Window Live Hotmail</span>
                </td>
                <td align="right">
                    <a href="#">Tìm kiếm bạn bè</a>
                </td>
                <hr class="private_color_hr" />
            </tr>
            <tr>
                <td align="right">
                    <img src="/../Content/Images/icon_otheremail.gif" alt="" />
                </td>
                <td>
                    <span class="private_font_bold">Các dịch vụ Email khác</span>
                </td>
                <td align="right">
                    <a href="#">Tìm kiếm bạn bè</a>
                </td>
                <hr class="private_color_hr" />
            </tr>
            <tr>
                <td align="right">
                    <img src="/../Content/Images/icon_othertool.gif" alt="" />
                </td>
                <td>
                    <span class="private_font_bold">Công cụ khác</span>
                </td>
                <td align="right">
                    <a href="#">Tìm kiếm bạn bè</a>
                </td>
                <hr class="private_color_hr" />
            </tr>
        </table>
    </div>
    <hr class="private_color_hr" />
    <!-- Thum ad hot -->
    <div class="private_thumb_listpr">
        <table>
            <tr>
                <%
                    List<Member> appFriends = new FriendHelper().getAllApprovedMembers(hMem.Member.MemId);
                    int i = 0;
                    foreach (Member fr in appFriends)
                    {
                       
                        
                %>
                <td>
                    <img width="130px" height="120px" src="/../Content/Images/Upload/<%=fr.MemAvatar %>" />
                    <center>
                        <%=fr.MemFullname %>
                    </center>
                    <br />
                    <a href="#" style="margin-left: 5px">
                        <img src="/../Content/Images/friend_add.jpg" /></a> <a href="#" class="modalInput"
                            onclick="email(<%=fr.MemId %>)" rel="#prompt" style="margin-left: 5px">
                            <img src="/../Content/Images/friend_email.jpg" /></a> <a href="#" class="modalInput1"
                                onclick="message(<%=fr.MemId %>)" rel="#prompt1" style="margin-left: 5px">
                                <img src="/../Content/Images/friend_mess.jpg" /></a> <a href="#" style="margin-left: 5px"  onclick="removeFriend(<%=hMem.Member.MemId %>,<%=fr.MemId %>)">
                                    <img src="/../Content/Images/friend_two.jpg" /></a>
                </td>
                <%
i++;
if (i % 4 == 0)
{
    Response.Write("</tr>");
    Response.Write("<tr>");
}
                    }
        
                %>
            </tr>
        </table>
        <script type="text/javascript">
            function email(val) {
                var ff = document.getElementById("friendEmailTo");
                ff.value = val;
            }
            function message(val) {
                var ff = document.getElementById("MemId");
                ff.value = val;
            }

            function removeFriend(memid, fid) {
            
                $.ajax({
                    type: "POST",
                    url: "/Friend/removeFriend",
                    data: "memId=" + memid + "&fId=" + fid,
                    success: function (result) {
                    
                        if (result == "true") {
                            alert("Từ chối bạn thành công");
                            window.location.reload(true);
                        }
                        else {
                            alert("Từ chối bạn thất bại");
                        }
                    },
                    error: function (req, status, error) {
                        alert("Sorry! We could not receive your feedback at this time.");
                    }
                });
            }
        </script>
    </div>
    <%--begin modal pop up --%>
    <div class="modal" id="prompt">
        <h2>
            Thông tin liên hệ</h2>
        <p>
            Thông tin này sẽ được gởi mail tới chủ gian hàng
        </p>
        <!-- input form. you can press enter too -->
        <form>
        <div id="emailLoader">
        </div>
        <table>
            <tr>
                <td>
                </td>
                <td>
                    <input type="hidden" id="friendEmailTo" />
                    <%=Html.TextBox("txtUserId", (Session["MemId"] == null ? "" : Session["MemId"]), new { @class = "lienhe-box hidden" })%>
                </td>
            </tr>
            <tr>
                <td>
                    Họ và tên:
                </td>
                <td>
                    <%=Html.TextBox("txtUserName", (Session["MemUserName"] == null ? "" : Session["MemUserName"]), new { @class = "lienhe-box" })%>
                </td>
            </tr>
            <tr>
                <td>
                    Địa chỉ Email:
                </td>
                <td>
                    <%=Html.TextBox("txtUserEmail", (Session["MemUserEmail"] == null ? "" : Session["MemUserEmail"]), new { @class = "lienhe-box" })%>
                </td>
            </tr>
            <tr>
                <td>
                    Nội dung:
                </td>
                <td>
                    <%=Html.TextArea("txtUserNoiDung", "", new { @class = "lienhe-textarea" })%>
                </td>
            </tr>
        </table>
        <center>
            <input type="button" id="EmailButton" class="private_bt_submit_news" value="Gởi" />
            <button type="button" class="close private_bt_submit_news">
                Cancel
            </button>
        </center>
        </form>
        <br />
    </div>
    <%--end modal popup--%>
    <%--begin modal pop up --%>
    <div class="modal" id="prompt1">
        <h2>
            Thông tin liên hệ</h2>
        <p>
            Thông tin này sẽ được gởi mail tới chủ gian hàng
        </p>
        <!-- input form. you can press enter too -->
        <div id="emailLoader2">
        </div>
        <div class="private_share_post">
            <div class="private_share_post_top">
                <div class="private_sharepost_menu">
                    <ul>
                        <li><a href="#" class="menu_select">Lời nhắn</a></li>
                    </ul>
                </div>
                <div class="private_button_left">
                    <div class="private_bt_newspost">
                        <% if (Session["MemId"] != null)
                           { %>
                    </div>
                    <div>
                        <form action="<%=Url.Action("SendMessage", "Message") %>" method="post" style="margin-top: 15px"
                        class="private_content_comment">
                        <input type="hidden" name="MemId" id="MemId" />
                        <div class="private_menu_topmenu">
                            <textarea class="input_full" rows="5" cols="50" id="txtComment" style="width: 550px"
                                name="txtComment"></textarea>
                        </div>
                        <div class="private_post_text">
                            <div style="background-color: white; margin: 10px 0px 10px 0px; width: 550px">
                                <span class="private_font_bold">Chọn icon: </span>
                                <% ChatHelper chat2 = new ChatHelper();
                                   List<ChatEmotionDetail> icons2 = chat2.getEmotionPath();
                                   foreach (ChatEmotionDetail icon in icons2)
                                   {
                                       Response.Write("<img align='middle' style='margin:3px' onclick='MemchatIconClick(this)' src='" + icon.path + "' id='" + icon.notation + "' width='30px' height='30px' />");

                                   }
                                %>
                            </div>
                            <script type="text/javascript">
                                function MemchatIconClick(obj) {
                                    $this = document.getElementById("txtComment");
                                    $this.value += obj.id;
                                }
                            </script>
                            <center style="margin: 5px;">
                                <input type="submit" style="width: 60px;" id="Submit1" value="Gửi" class="private_bt_submit_news_disable" />
                            </center>
                        </div>
                        </form>
                    </div>
                </div>
                <% }
                           else
                           {
                               Response.Write("</div>");
                               Response.Write("</div>");
                           } 
                %>
                <div style="clear: both">
                </div>
            </div>
        </div>
        <br />
    </div>
    <%--end modal popup--%>
    <!-- End Thum ad hot -->
    <center>
        <div class="private_breakpage">
            <a href="#">
                <img src="/../Content/Images/arrow_breakpage_left.gif" alt="" />&nbsp;Trang trước</a>
            <a href="#" class="menu_select">1</a> <a href="#">2</a> <a href="#">3</a> <a href="#">
                4</a> <a href="#">5</a> <a href="#">6</a> <a href="#">7</a> <a href="#">Trang sau&nbsp;<img
                    src="/../Content/Images/arrow_breakpage_right.gif" alt="" /></a>
        </div>
    </center>
</asp:Content>
